package Covid2;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.checkerframework.checker.units.qual.C;

import java.io.IOException;

public class Covid2Mapper extends Mapper<LongWritable, Text,Text,CovidBean> {

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, CovidBean>.Context context) throws IOException, InterruptedException {

        String line = value.toString();
        String[] words = line.split(",");
        Text outkey = new Text(words[2]);
        CovidBean outvalue = new CovidBean(Long.parseLong(words[4]),Long.parseLong(words[5]));
        context.write(outkey,outvalue);

    }
}
